page setup dialog: Use headerbar
authorWilliam Jon McCann <william.jon.mccann@gmail.com>
Sun, 8 Dec 2013 14:54:17 +0000 (15:54 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 17 Jan 2014 22:52:08 +0000 (17:52 -0500)
Make the page setup dialog use a headerbar when desired.

https://bugzilla.gnome.org/show_bug.cgi?id=720059

gtk/gtkpagesetupunixdialog.c
gtk/gtkpagesetupunixdialog.ui
gtk/gtkpagesetupunixdialog.ui.h

index 4288b8d9c5719a9eb99d239678f9296678a4d6d1..5601aefe36460c16b9adf43f6da226021358b337 100644 (file)
@@ -43,6 +43,7 @@
 #include "gtkprintbackend.h"
 #include "gtkpapersize.h"
 #include "gtkprintutils.h"
+#include "gtkdialogprivate.h"
 
 /**
  * SECTION:gtkpagesetupunixdialog
@@ -190,6 +191,19 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
   priv->print_backends = NULL;
 
   gtk_widget_init_template (GTK_WIDGET (dialog));
+  gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (dialog));
+  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                          _("_Cancel"), GTK_RESPONSE_CANCEL,
+                          _("_Apply"), GTK_RESPONSE_OK,
+                          NULL);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
   /* Do this in code, we want the translatable strings without the markup */
   gtk_list_store_append (priv->printer_list, &iter);
@@ -213,12 +227,6 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
   /* Load data */
   _gtk_print_load_custom_papers (priv->custom_paper_list);
   load_print_backends (dialog);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 static void
index a6059f6946fd703392fbd992312e69cdab3cf823..46fe97b5f6304465edd6c9cb263ff292ef01f85b 100644 (file)
     <property name="border_width">5</property>
     <property name="resizable">False</property>
     <property name="type_hint">dialog</property>
+    <property name="title" translatable="yes">Page Setup</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="cancel_button">
-                <property name="label" translatable="yes">_Cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="apply_button">
-                <property name="label" translatable="yes">_Apply</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkGrid" id="grid1">
             <property name="visible">True</property>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-6">cancel_button</action-widget>
-      <action-widget response="-5">apply_button</action-widget>
-    </action-widgets>
   </template>
 </interface>
index ab92261eac19d4b7e19da17e473e037b57759445..8ee6315470f2e0dfcbc0f875d00fd80075a6ced3 100644 (file)
@@ -1,5 +1,4 @@
-N_("_Cancel");
-N_("_Apply");
+N_("Page Setup");
 N_("_Format for:");
 N_("_Paper size:");
 N_("_Orientation:");